<!DOCTYPE html>
<html>
<head>
    <title>用户项目分配管理</title>
<#include "../common/common.ftl"/>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header">一、用户基本信息</div>
        <div class="layui-card-body">

            <div class="layui-form-item">
                <label class="layui-form-label">所属部门：</label>
                <div class="layui-form-mid">${(userInfo.department.name)!}</div>

            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">真实姓名：</label>
                <div class="layui-form-mid">${(userInfo.name)!}</div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label">账号：</label>
                <div class="layui-form-mid">${(userInfo.username)!}</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">角色：</label>
                <div class="layui-form-mid">${(roles)!}</div>
            </div>
        </div>
    </div>

    <div class="layui-card">
        <div class="layui-card-header">二、征收项目分配</div>
        <div class="layui-card-body">
            <form class="layui-form" action="">
                <input type="hidden" name="userInfoId" value="${(userInfo.id)!}"/>
                <div class="layui-form-item">
                    <label class="layui-form-label">征收项目：</label>
                    <div class="layui-input-block">
                    <#list zsProjectList as zsProject>
                        <input type="checkbox" name="zsProjectIds" value="${(zsProject.id)!}" lay-skin="primary"
                               title="<#if zsProject.town?? && zsProject.town=='01'>宝盖镇</#if>
                               <#if zsProject.town?? && zsProject.town=='02'>/</#if>
                               <#if zsProject.town?? && zsProject.town=='03'>/</#if>
                               <#if zsProject.town?? && zsProject.town=='04'>/</#if>
                               <#if zsProject.town?? && zsProject.town=='07'>/</#if>
                               ${zsProject.projectName}"
                               <#if zsProjectIdList?seq_contains((zsProject.id)!)>checked</#if>/>
                    </#list>
                    </div>
                </div>

                <button style="display: none;" class="layui-btn" id="submitBtn" name="submitBtn" lay-submit=""
                        lay-filter="submit">立即提交
                </button>
            </form>
        </div>
    </div>
</div>
<script src="/layui/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'jquery'], function () {
        var form = layui.form, $ = layui.jquery, parentCroppersIndex = parent.layer.getFrameIndex(window.name);

        //父页面通过submit按钮click方法，触发以下验证功能
        form.on('submit(submit)', function (data) {
            $.ajax({
                url: "zsProjectUserSave"
                , type: "post"
                , data: $("form").serializeArray()
                , success: function (data) {
                    if (data.code == "0001") {
                        layer.alert("保存成功！")
                        parent.loadData();
                        parent.layer.close(parentCroppersIndex);
                    } else {
                        layer.msg(data.message, {anim: 6, icon: 2});
                    }
                }
            });
            return false;
        });
    });
</script>
</body>
</html>